//...
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <iostream>
#include <list>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;

map<int,int> m;
bool o;
int a, b, n, i, j;
int main (){
	freopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);
	scanf("%d%d", &a, &n);
	while(a+n){
		m.clear();
		o=1;
		for(i=0;i<n;++i){
			scanf("%d%d", &a, &b);
			if(o){
				j= ++m[b];
				if(j>2)o=0;
				j= ++m[a];
				if(j>2)o=0;
			}
		}
		if(o)printf("Y\n");
		else printf("N\n");
		scanf("%d%d", &a, &n);
	}
	return 0;
}
